﻿using Fabao.Shared.Domain;
using SqlSugar;

namespace System.Domain.Entities
{
    [SugarTable("menu")]
    public class Menu : BaseEntity, IAggregateRoot
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public string content { get; set; }
        /// <summary>
        /// 父级id
        /// </summary>
        public int parentId { get; set; }
        /// <summary>
        /// 路径
        /// </summary>
        public string url { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int px { get; set; }
        /// <summary>
        /// 0正常1禁用
        /// </summary>
        public int isDel { get; set; }
        /// <summary>
        /// 图标
        /// </summary>
        public string icon { get; set; }
        /// <summary>
        /// 1菜单2按钮
        /// </summary>
        public int typeId { get; set; }
        /// <summary>
        /// 按钮显示名称
        /// </summary>
        public string btnName { get; set; }
        /// <summary>
        /// 按钮英文标记名称
        /// </summary>
        public string btnEnName { get; set; }
        [SugarColumn(IsIgnore = true)]
        public List<Menu> child { get; set; }

        /// <summary>
        /// 改变状态
        /// </summary>
        public void ChangeState()
        {
            if (this.isDel == 0)
            {
                this.isDel = 1;
            }
            else if (this.isDel == 1)
            {
                this.isDel = 0;
            }
        }
    }
}
